<?php

declare(strict_types=1);

namespace App\CustHub\Model;

use Mine\MineModel;

/**
 * @property int $id 
 * @property int $code_id 
 * @property int $room_id 
 * @property int $status 状态（1 = 正常，2 = 停用）
 * @property int $allocate_status 分配状态
 * @property int $is_new_create 是否新建（0 = 否，1 = 是）
 * @property int $is_show 是否展示（0 = 否，1  = 是）
 * @property int $daily_visit 今日访问数
 * @property int $total_visit 总访问数
 * @property int $visit_limit 访问限制数
 * @property int $sort 排序
 * @property int $join_visit 进群数量
 * @property int $daily_join_visit 今日进群数量
 * @property string $create_user_id 建群机器人user_id
 * @property string $room_wxid room_wxid
 * @property int $main_uid 
 * @property int $uid 
 * @property int $daily_out_visit 
 * @property int $out_visit 
 * @property-read null|ChRoom $room 
 */
class ChRoomCodeRoomRelation extends MineModel
{
    public bool $timestamps = false;
    /**
     * The table associated with the model.
     */
    protected ?string $table = 'ch_room_code_room_relation';

    /**
     * The attributes that are mass assignable.
     */
    protected array $fillable = ['id', 'code_id', 'room_id', 'status', 'allocate_status', 'is_new_create', 'is_show', 'daily_visit', 'total_visit', 'visit_limit', 'sort', 'join_visit', 'daily_join_visit', 'create_user_id', 'room_wxid', 'main_uid', 'uid', 'daily_out_visit', 'out_visit'];

    /**
     * The attributes that should be cast to native types.
     */
    protected array $casts = ['id' => 'integer', 'code_id' => 'integer', 'room_id' => 'integer', 'status' => 'integer', 'allocate_status' => 'integer', 'is_new_create' => 'integer', 'is_show' => 'integer', 'daily_visit' => 'integer', 'total_visit' => 'integer', 'visit_limit' => 'integer', 'sort' => 'integer', 'join_visit' => 'integer', 'daily_join_visit' => 'integer', 'main_uid' => 'integer', 'uid' => 'integer', 'daily_out_visit' => 'integer', 'out_visit' => 'integer'];

    public function room()
    {
        return $this->belongsTo(ChRoom::class, 'room_id', 'id');
    }
}
